using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using MobileWebsiteGenerator.Entities;

namespace MobileWebsiteGenerator.Mapping
{
	public class ThemePictureRELMap : EntityTypeConfiguration<ThemePictureREL>
	{
		public ThemePictureRELMap()
		{
			// Primary Key
			this.HasKey(t => t.Theme_picture_id);

			// Properties
			this.Property(t => t.Theme_picture_id)
				.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
				
			// Table & Column Mappings
			this.ToTable("ThemePictureREL");
			this.Property(t => t.Theme_picture_id).HasColumnName("Theme_picture_id");
			this.Property(t => t.Theme_id).HasColumnName("Theme_id");
			this.Property(t => t.Picture_id).HasColumnName("Picture_id");

			// Relationships
			this.HasRequired(t => t.pictureGallery)
				.WithMany(t => t.ThemePictureRELs)
				.HasForeignKey(d => d.Picture_id);
				
			this.HasRequired(t => t.ThemeDetail)
				.WithMany(t => t.ThemePictureRELs)
				.HasForeignKey(d => d.Theme_id);
				
		}
	}
}

